package io.renren.modules.sys.service.impl;

import io.renren.modules.sys.entity.FeedbackVOEntity;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;


import io.renren.modules.sys.dao.FeedbackDao;
import io.renren.modules.sys.entity.FeedbackEntity;
import io.renren.modules.sys.service.FeedbackService;


@Service("feedbackService")
public class FeedbackServiceImpl extends ServiceImpl<FeedbackDao, FeedbackEntity> implements FeedbackService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        int pageSize = Integer.parseInt(params.get("limit").toString());  //每页记录数
        int currPage = Integer.parseInt(params.get("page").toString());  //当前页数

        String username = null;
        if( params.get("username")!=null&&!params.get("username").equals("")){
            username = params.get("username").toString();
        }

        String telphone = null;
        if( params.get("telphone")!=null&&!params.get("telphone").equals("")){
            telphone = params.get("telphone").toString();
        }
        int count = baseMapper.queryListcount(username,telphone);
        List<FeedbackVOEntity> list = baseMapper.querylistByParams(username,telphone,(currPage-1)*pageSize,currPage*pageSize);

        return new PageUtils(list,count,pageSize,currPage);
    }

}
